package com.kc.sjwh.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kc.sjwh.other.Cfg;
import com.kc.sjwh.service.SysService;

/**
 * 主Action
 * date: 2017年5月16日
 * @author zhangGuihua(hua7381@163.com)
 */
@Controller
@RequestMapping("main")
public class MainAction extends BaseAction {
	static Logger logger = Logger.getLogger(MainAction.class);
	
	@Autowired
	SysService sysService;
	
	@RequestMapping("main")
	public String main(HttpServletRequest req) {
		String menusHtml = sysService.loadMenusHtml(getLoginUser().getId());
		
		req.setAttribute("webTitle", Cfg.getInst().getWebTitle());
		req.setAttribute("menusHtml", menusHtml);
		
		return "main/main";
	}
	
	//打开首页
	@RequestMapping("home")
	public String home(HttpServletRequest req) {
		req.getSession().setAttribute("webTitle", Cfg.getInst().getWebTitle());
		return "main/home";
	}
	
	//打开-设置皮肤
	@RequestMapping("toSetSkin")
	public String toSetSkin() {
		return "main/toSetSkin";
	}
	
	//打开-设置字体大小
	@RequestMapping("toSetFontSize")
	public String toSetFontSize() {
		return "main/toSetFontSize";
	}

	//打开图标选择页
	@RequestMapping("iconSelector")
	public String iconSelector(HttpServletRequest req) {
		return "main/iconSelector";
	}
	
	//打开调试页
	@RequestMapping("debug")
	public String debug(HttpServletRequest req) {
		return "main/debug";
	}
	
}
